<!DOCTYPE html>
<html>
	<head>
		<meta charset="UTF-8">
		<title>路由,像是局部刷新</title>
		<script src="../js/angular.min.js"></script>
		<script src="../js/angular-route.min.js"></script>
	</head>
	<body ng-app="appAngular">
		<h4>Head</h4>
			<div>
				<ul>
					<li> <a href="#/">首页</a> </li>
					<li> <a href="#/users">用户管理</a> </li>
					<li> <a href="#/products">商品管理</a> </li>
				</ul>
			</div>
			
		<div ng-view></div>
		
		<h4>尾巴</h4>
	</body>
	
	<script>
		// 初始化angular
		var ma = angular.module("appAngular",['ngRoute']);
		ma.config(function($routeProvider){
			$routeProvider.when("/", {
				templateUrl : 'parent.html'
			}).when("/users", {
				templateUrl : 'users.html'
			}).when("/products", {
				templateUrl : 'products.html'
			}).otherwise({
				redirectTo : '/'
			});
			
		});
	</script>
</html>
